using UnityEngine;

public class RougeSceneTriggerManager : MonoBehaviour
{
    [SerializeField] private Collider2D[] _boundTriggers;

    private void OnEnable()
    {
        EventCenter.AddEventListener(EventName.StartRougeGame, SetBoundTriggerToCollider);
        EventCenter.AddEventListener(EventName.CurrentWaveFinish, SetBoundColliderToTrigger);
    }

    private void OnDisable()
    {
        EventCenter.RemoveEventListener(EventName.StartRougeGame, SetBoundTriggerToCollider);
        EventCenter.RemoveEventListener(EventName.CurrentWaveFinish, SetBoundColliderToTrigger);
    }

    private void SetBoundTriggerToCollider()
    {
        for (int i = 0; i < _boundTriggers.Length; i++)
        {
            _boundTriggers[i].isTrigger = false;
        }
    }
    private void SetBoundColliderToTrigger()
    {
        for (int i = 0; i < _boundTriggers.Length; i++)
        {
            _boundTriggers[i].isTrigger = true;
        }
    }
}
